package com.ohimy.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 群组相册评论封装类
 * 
 * @author Tony Tang
 * @version 1.0
 */
@Entity
@MappedSuperclass
@Table(name = "ohimy_group_photo_comment")
public class GroupPhotoComment implements Serializable {

	private static final long serialVersionUID = -549507987889923242L;

	private long id;

	private GroupPhoto groupPhoto; // 所属圈子相册

	private String content; // 评论内容

	private User commer; // 评论人

	private Date created; // 发布时间

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false)
	public GroupPhoto getGroupPhoto() {
		return groupPhoto;
	}

	public void setGroupPhoto(GroupPhoto groupPhoto) {
		this.groupPhoto = groupPhoto;
	}

	@Lob()
	@Column(name = "_content")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false)
	public User getCommer() {
		return commer;
	}

	public void setCommer(User commer) {
		this.commer = commer;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "_created", updatable = false)
	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

}
